package com.todo.strategy.online.application.frontend.service.impl;

import com.todo.common.common.entity.response.BizPageResponse;
import com.todo.common.common.entity.response.page.PageResult;
import com.todo.strategy.online.application.convert.StrategyConvert;
import com.todo.strategy.online.application.entity.bo.BasicStrategyBO;
import com.todo.strategy.online.application.entity.bo.StrategySearchBO;
import com.todo.strategy.online.application.frontend.service.StrategyPortalAggService;
import com.todo.strategy.online.application.service.BasicStrategyService;
import com.todo.strategy.online.iface.request.FollowFeedStreamStrategyParam;
import com.todo.strategy.online.iface.request.RecommendStrategyListV1Param;
import com.todo.strategy.online.iface.request.SearchPlatformStrategyParam;
import com.todo.strategy.online.iface.request.SearchStrategyParam;
import com.todo.strategy.online.iface.response.StrategyBaseVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * (PlatformStrategyDetail)表服务实现类
 *
 * @author zhangwenxiang
 * @since 2024-03-04 00:19:47
 */
@Slf4j
@Service("strategyPortalAggService")
public class StrategyPortalAggServiceImpl implements StrategyPortalAggService {


    @Resource
    private BasicStrategyService basicStrategyService;

    @Override
    public BizPageResponse<StrategyBaseVO> searchStrategy(SearchStrategyParam param) {
        if (param == null || !param.baseCheck()) {
            return BizPageResponse.success();
        }
        //todo userInfo 填充
        StrategySearchBO strategySearchBO = StrategyConvert.convertToStrategySearchBO(param);
        PageResult<BasicStrategyBO> pageResult = basicStrategyService.searchStrategy(strategySearchBO);
        return BizPageResponse.success(StrategyConvert.convertToStrategyBaseVOPageResult(pageResult));
    }

    @Override
    public BizPageResponse<StrategyBaseVO> searchPlatformStrategy(SearchPlatformStrategyParam param) {
        if (param == null || !param.baseCheck()) {
            return BizPageResponse.success();
        }
        //todo userInfo 填充
        StrategySearchBO strategySearchBO = StrategyConvert.convertToStrategySearchBO(param);
        PageResult<BasicStrategyBO> pageResult = basicStrategyService.searchStrategy(strategySearchBO);
        return BizPageResponse.success(StrategyConvert.convertToStrategyBaseVOPageResult(pageResult));
    }

    @Override
    public BizPageResponse<StrategyBaseVO> followFeedStreamStrategy(FollowFeedStreamStrategyParam param) {
        return null;
    }

    @Override
    public BizPageResponse<StrategyBaseVO> recommendPlatformStrategyListV1(RecommendStrategyListV1Param param) {
        return null;
    }
}
